﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;

namespace RealtorsPortal.AdminCP
{
    public partial class ConfigurationWebsite : System.Web.UI.Page
    {
        string duration;
        string display;
        string currency;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.LoadAndFillData();
            }
        }

        private void LoadAndFillData()
        {
            duration = WebConfigurationManager.AppSettings["duration"].ToString();
            display = WebConfigurationManager.AppSettings["display"].ToString();
            currency = WebConfigurationManager.AppSettings["currency"].ToString();
            txtDisplay.Text = display;
            txtDuration.Text = duration;
            txtCurrency.Text = currency;
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            WebConfigurationManager.AppSettings["duration"] = txtDuration.Text;
            WebConfigurationManager.AppSettings["display"] = txtDisplay.Text;
            WebConfigurationManager.AppSettings["currency"] = txtCurrency.Text;
        }
    }
}